﻿using System;
using System.Linq;
using System.Xml.Serialization;

using Fuse8.ContentManagementFramework.SystemFacade.Extensions;

namespace Fuse8.ContentManagementFramework.Domain.Special
{
    [Serializable]
    public class CmsPagePropertiesContainer //TODO: rename it to CmsEntityProperty
    {
        [XmlArrayItem("Property")]
        public CmsPagePropertyItem[] Properties { get; set; }

        public override string ToString()
        {
            Properties = (Properties ?? new CmsPagePropertyItem[0]).Where(p => !string.IsNullOrEmpty(p.PropertyName)).ToArray();
            return this.StoreMe();
        }
    }

    [Serializable]
    public class CmsPagePropertyItem
    {
        public string PropertyName { get; set; }

        public string PropertyValue { get; set; }
    }
}
